﻿///MulCircle.as 该类为多圆环形类
//vesion 1.0
//author 夏天的树人

package org.summerTree.graphics
{

	import flash.geom.Point;
	public class MulCircle extends Base
	{

		public function MulCircle()
		{

		}
		override public  function clone():*
		{
			return new MulCircle();
		}
		
		//绘制一个多圆
		/*radius 半径
		 *fillColor 填充颜色
		 *alpha 透明度
		 */
		public function CreatMulCircle(radius:Number,count:Number=10,fillColor:Number=0xFFFF00,alpha:Number=1):void
		{
			
			if(count<=0) return;
			this.graphics.lineStyle(linekness,color);
			
			var angle:Number=2*Math.PI/count;
			var Length:Number=getLength(radius,angle);
			for(var i:int=0;i<count;i++)
			{			
			  var point:Point=Point.polar(radius,i*angle);
			  this.graphics.beginFill(fillColor,alpha);
			  this.graphics.drawCircle(point.x,point.y,Length);		
			  this.graphics.endFill();
			}	
		}
		
		
		//计算出两个圆的连线长度,即计算出单个圆的半径
		private function getLength(radius:Number,angle:Number):Number
		{
			var Length:Number;
			Length=2*radius*radius-2*radius*radius*Math.cos(angle);
			return Math.sqrt(Length)/2;			
		}
	}
}